package com.wilmer.children.service.impl;

import java.util.List;

import com.wilmer.common.annotation.DataScope;
import com.wilmer.common.utils.DateUtils;
import com.wilmer.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wilmer.children.mapper.YwChildrenMapper;
import com.wilmer.children.domain.YwChildren;
import com.wilmer.children.service.IYwChildrenService;

/**
 * 幼儿Service业务层处理
 *
 * @author hans
 * @date 2024-05-19
 */
@Service
public class YwChildrenServiceImpl implements IYwChildrenService
{
    @Autowired
    private YwChildrenMapper ywChildrenMapper;

    /**
     * 查询幼儿
     *
     * @param children 幼儿主键
     * @return 幼儿
     */
    @Override
    public YwChildren selectYwChildrenByChildren(Long children)
    {
        return ywChildrenMapper.selectYwChildrenByChildren(children);
    }

    /**
     * 查询幼儿列表
     *
     * @param ywChildren 幼儿
     * @return 幼儿
     */
    @DataScope(deptAlias = "d")
    @Override
    public List<YwChildren> selectYwChildrenList(YwChildren ywChildren)
    {
        return ywChildrenMapper.selectYwChildrenList(ywChildren);
    }

    /**
     * 新增幼儿
     *
     * @param ywChildren 幼儿
     * @return 结果
     */
    @Override
    public int insertYwChildren(YwChildren ywChildren)
    {
        ywChildren.setCreateTime(DateUtils.getNowDate());
        ywChildren.setCreateBy(SecurityUtils.getUsername());
        return ywChildrenMapper.insertYwChildren(ywChildren);
    }

    /**
     * 修改幼儿
     *
     * @param ywChildren 幼儿
     * @return 结果
     */
    @Override
    public int updateYwChildren(YwChildren ywChildren)
    {
        ywChildren.setUpdateTime(DateUtils.getNowDate());
        return ywChildrenMapper.updateYwChildren(ywChildren);
    }

    /**
     * 批量删除幼儿
     *
     * @param childrens 需要删除的幼儿主键
     * @return 结果
     */
    @Override
    public int deleteYwChildrenByChildrens(Long[] childrens)
    {
        return ywChildrenMapper.deleteYwChildrenByChildrens(childrens);
    }

    /**
     * 删除幼儿信息
     *
     * @param children 幼儿主键
     * @return 结果
     */
    @Override
    public int deleteYwChildrenByChildren(Long children)
    {
        return ywChildrenMapper.deleteYwChildrenByChildren(children);
    }
}
